import requests from "@/api/request.js"

export const req_login = (account, password) => {
    return requests({
        url: '/account/login',
        method: 'post',
        data: {
            "account": account,
            "password": password
        }
    })
}

export const req_register = (user_name, email, password) => {
    return requests({
        url: '/account/register',
        method: 'post',
        data: {
            "user_name": user_name,
            "email": email,
            "password": password
        }
    })
}

export const req_logout = () => {
    return requests({
        url: '/account/logout',
        method: 'post'
    })
}

export const req_starGet = (user) => {
    return requests({
        url: '/star', //?
        method: 'get',
        data: {
            user: user,
        }
    })
}

export const req_starDel = (star) => {
    return requests({
        url: '/star', //?
        method: 'get',
        data: {
            star: star,
        }
    })
}


export const req_userGet = () => {
    return requests({
        url: '/account/current',
        method: 'get'
    })
}

export const req_searchSuggestions = (type, keyword) => {
    return requests({
        url: `/search/suggest`,
        method: 'get',
        params: {
            type: type,
            keyword: keyword,
        }
    });
}

// 获取门户申领列表
export const req_applyList = () => {
    return requests({
        url: '/portal/apply-list',
        method: 'post',
    })
}

// 驳回申领门户请求的接口
export const req_rejectClaim = (claimId) => {
    return requests({
        url: '/api/reject-claim',
        method: 'post',
        data: {
            "claimId": claimId
        },
    });
}

//通过申领门户请求的接口
export const req_approveClaim = (claimId) => {
    return requests({
        url: '/portal/approve-claim',
        method: 'post',
        data: {
            "claimId": claimId
        }
    });
};

//获取单个核心对象-期刊的接口
export const req_getVenueInfo = (venueId) => {
    return requests({
        url: `/entity/venue/${venueId}`,
        method: 'get',
    });
};